<?php

namespace App\Http\Controllers\Api\V1\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class RewardResource extends JsonResource
{
	public function toArray($request)
	{
		$resource = $this->resource;
		
		return [
			'id'                => (int)$resource->id,
			'is_open'             =>  $resource->is_open ?? 0,
			'product'              => new  ProductResource($resource->product),
			'money'      =>(int)$resource->money,
			'created_at'          =>(string)$resource->created_at,
			
		];
	}
}
